package com.serv.common.model.sys;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

@SuppressWarnings("serial")
public class User extends Model<User> {
	public static User dao = new User().dao();
	
	public Organization organization() {
		String sql = "select * from sys_organization where id=?";
		return Organization.dao.findFirst(sql,get("organization_id"));
	}
	
	public List<Role> roles() {
		String sql = "select R.* from sys_user_role UR left join sys_role R on UR.role_id=R.id where UR.user_id=?";
		return Role.dao.find(sql,get("id"));
	}
}
